﻿<UserControl x:Class="MVVM.Northwind.Employee.View.EmployeeListView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"                       
             mc:Ignorable="d" 
             d:DesignHeight="350" d:DesignWidth="670">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="EmployeeListViewDictionary.xaml"/>
            </ResourceDictionary.MergedDictionaries>            
        </ResourceDictionary>              
    </UserControl.Resources>
    <StackPanel Orientation="Horizontal">
        <Grid Width="175" Margin="5,5,5,5" Style="{StaticResource RecordGridStyle}">
            <Border BorderBrush="Black" BorderThickness="2"/>
            <Grid>                
                <Grid.RowDefinitions>
                    <RowDefinition Height=".5*"/>
                    <RowDefinition Height="2*"/>
                </Grid.RowDefinitions>
                <Border BorderBrush="Black" BorderThickness="2"/>
                <StackPanel Margin="5,5,5,5" Grid.Row="0">
                    <TextBlock Text="Search Employees" Width="150" FontSize="13" FontWeight="Bold" TextAlignment="Center"/>
                    <StackPanel Orientation="Horizontal">
                        <TextBox Text="{Binding Path=SearchText, Mode=OneWayToSource}" Height="30" 
                                 Margin="5,5,5,5" Width="100" />
                        <Button Content="Go" Command="{Binding Path=SearchEmployeeCommand}" 
                                Width="45" Margin="5,5,5,5" />
                    </StackPanel>                    
                </StackPanel>
                <ScrollViewer Grid.Row="1" Margin="5,5,5,5">
                    <StackPanel Height="225" Margin="5,5,5,5">
                        <ItemsControl ItemsSource="{Binding Path=SearchedEmployees}"                                  
                                VerticalAlignment="Center" ItemTemplate="{StaticResource EmployeeSearchTemplate}"/>                         
                        
                    </StackPanel>
                </ScrollViewer>
                               
            </Grid>           
        </Grid>
        <StackPanel>            
            <Grid DataContext="{Binding Path=EmployeeCollection.View}" Width="475"
                  Style="{StaticResource RecordGridStyle}" Margin="5,5,5,5" >               

                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="88*" />
                    <ColumnDefinition Width="122*" />
                    <ColumnDefinition Width="65*" />
                    <ColumnDefinition Width="107*" />
                    <ColumnDefinition Width="121*" />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="24*" />
                    <RowDefinition Height="41*" />
                    <RowDefinition Height="40*" />
                    <RowDefinition Height="44*" />
                    <RowDefinition Height="42*" />
                    <RowDefinition Height="49*" />
                    <RowDefinition Height="71*" />
                </Grid.RowDefinitions>
                <TextBlock Text="Employee Information" Grid.ColumnSpan="5" 
                           TextAlignment="Center" FontWeight="Bold" FontSize="20" Foreground="Black" />
                <Label Content="Employee ID"  Height="30" Grid.Row="1"  Margin="5,5,5,5" />

                <ComboBox Name="empID" Grid.Row="1" Grid.Column="1" Margin="5,5,5,5" 
                          ItemsSource="{Binding}" DisplayMemberPath="EmployeeID"/>
                
                <TextBlock Text="Last Name" Margin="5,5,5,5" Height="30" Grid.Row="2" Grid.ColumnSpan="1" />
                <TextBlock Text="First Name" Margin="5,8,5,5" Height="30" Grid.Row="3" Grid.ColumnSpan="1" />
                <TextBlock Text="Designation" Margin="5,8,5,5" Height="30" Grid.Row="4" Grid.ColumnSpan="1" />
                <TextBlock Text="Adress" Margin="5,8,5,5" Height="30" Grid.Row="5" Grid.ColumnSpan="1" />
                <TextBlock Text="D.O.B" Margin="5,8,5,5" Height="30" Grid.Row="2" Grid.Column="2" />
                <TextBlock Text="D.O.H" Margin="5,8,5,5" Height="30" Grid.Row="3" Grid.Column="2" />
                <TextBlock Text="Phone" Margin="5,8,5,5" Height="30" Grid.Row="4" Grid.Column="2" />
                <TextBox Grid.Row="2" Grid.Column="1" Margin="5,5,5,5" Text="{Binding Path=LastName, Mode=TwoWay}" />
                <TextBox Grid.Row="3" Grid.Column="1" Margin="5,5,5,5" Text="{Binding Path=FirstName, Mode=TwoWay}"/>
                <TextBox Grid.Row="4" Grid.Column="1" Margin="5,5,5,5" Text="{Binding Path=Title, Mode=TwoWay}"/>
                <TextBox Grid.Row="2" Grid.Column="3" Margin="5,5,5,5" Text="{Binding Path=BirthDate, Mode=TwoWay}"/>
                <TextBox Grid.Row="3" Grid.Column="3" Margin="5,5,5,5" Text="{Binding Path=HireDate, Mode=TwoWay}"/>
                <TextBox Grid.Row="4" Grid.Column="3" Margin="5,5,5,5" Text="{Binding Path=HomePhone, Mode=TwoWay}"/>
                <Image Grid.Row="2" Grid.Column="5" Grid.RowSpan="3" Margin="5,5,5,5"
                       Source="{Binding Path=Photo, Converter={StaticResource ImageConverter}}"/>
                <TextBox Grid.Row="5" Grid.Column="1" Margin="5,5,5,5" Text="{Binding Path=Address, Mode=TwoWay}"/>
                <StackPanel Grid.Row="5" Grid.Column="2">
                    <Label Name="lblCity" Content="City"/>
                    <Label Name="lblState" Content="State"/>
                </StackPanel>
                <StackPanel Grid.Row="5" Grid.Column="3">
                    <TextBox Margin="5,2,5,5" Text="{Binding Path=City, Mode=TwoWay}" />
                    <TextBox Margin="5,2,5,2" Text="{Binding Path=Region, Mode=TwoWay}" />
                </StackPanel>
                <StackPanel Grid.Row="5" Grid.Column="4" Orientation="Horizontal">
                    <Label Content="Zip" Height="30" />
                    <TextBox Width ="75" Height="30" Margin="5,5,5,5" Text="{Binding Path=PostalCode, Mode=TwoWay}"/>
                </StackPanel>
            </Grid>
            <Grid Margin="5,5,5,5" Background="Brown" >                
                <Grid.RowDefinitions>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                
                <Slider Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="4" VerticalAlignment="Bottom" 
                         IsSnapToTickEnabled="True" TickPlacement="BottomRight" Value="{Binding ElementName=empID,Path=Text}"/>                
                
                <Button Content="Edit" Command="{Binding Path=NavigateBackCommand }" Width="75" Style="{StaticResource GlassButton}" Grid.Row="1" Grid.Column="0" />
                <Button Content="Save" Command="{Binding Path=SaveEmployeeCommand }" Width="75" Style="{StaticResource GlassButton}" Grid.Row="1" Grid.Column="1"/>
                <Button Content="Cancel" Command="{Binding Path=CancelEmployeeCommand}" Width="75" Style="{StaticResource GlassButton}" Grid.Row="1" Grid.Column="2" />
                <Button Content="Delete" Command="{Binding Path=DeleteEmployeeCommand }" Width ="75" Style="{StaticResource GlassButton}"  Grid.Row="1" Grid.Column="3"/>
            </Grid>
        </StackPanel>        
    </StackPanel>
    
</UserControl>
